<?php
	// session_start();
	include "init.php";
	date_default_timezone_set('Asia/Shanghai');//设置时区
	$error = "";
	$code=mb_convert_encoding($_SESSION['str'],'UTF-8','GBK');
	if ($code!=$_POST['cap']) {
		echo json_encode(array('code'=>'400','msg'=>'保存失败！'));
		
	}else{
		$nickname = addslashes($_POST['nickname']);
		$email = addslashes($_POST['email']);
		$message_content = addslashes($_POST['message_content']);
		$message_time=time();
		$article_id=$_POST['article_id'];

		$sql="INSERT INTO `message`( `nickname`, `email`, `message_content`, `message_time`, `article_id`) VALUES ('{$nickname}','{$email}','{$message_content}','{$message_time}','{$article_id}')";

		$mysql->query($sql);
		
		echo json_encode(array('code'=>'000','msg'=>'保存成功'));
		// header("location:single.php?art_id=".$_POST['article_id']);
		exit;
	}
	
	
	// 留言板回复
	// if (!empty($_POST['art_id'])&&!empty($_POST['review_word'])) {
		
	// }